<?php
namespace app\index\controller;

use think\cache\driver\Redis;
use think\Controller;

class Demon extends Controller
{

    public function curl($data)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, "http://192.168.10.10:9502");
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HEADER, 1);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_exec($curl);
        curl_close($curl);

        //初始化
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL,"http://192.168.10.10:9502");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $output = curl_exec($ch);
        curl_close($ch);

    }

    /**
     * 主动触发
     */
    public function activepush()
    {

        $param['message'] = '主动推送消息';
        $param['uid'] = 1;
        $this->curl($param);            // 主动推送消息
    }
}